# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1PipelineJobRuntimeConfig do
  @moduledoc """
  The runtime config of a PipelineJob.

  ## Attributes

  *   `failurePolicy` (*type:* `String.t`, *default:* `nil`) - Represents the failure policy of a pipeline. Currently, the default of a pipeline is that the pipeline will continue to run until no more tasks can be executed, also known as PIPELINE_FAILURE_POLICY_FAIL_SLOW. However, if a pipeline is set to PIPELINE_FAILURE_POLICY_FAIL_FAST, it will stop scheduling any new tasks when a task has failed. Any scheduled tasks will continue to completion.
  *   `gcsOutputDirectory` (*type:* `String.t`, *default:* `nil`) - Required. A path in a Cloud Storage bucket, which will be treated as the root output directory of the pipeline. It is used by the system to generate the paths of output artifacts. The artifact paths are generated with a sub-path pattern `{job_id}/{task_id}/{output_key}` under the specified output directory. The service account specified in this pipeline must have the `storage.objects.get` and `storage.objects.create` permissions for this bucket.
  *   `inputArtifacts` (*type:* `%{optional(String.t) => GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1PipelineJobRuntimeConfigInputArtifact.t}`, *default:* `nil`) - The runtime artifacts of the PipelineJob. The key will be the input artifact name and the value would be one of the InputArtifact.
  *   `parameterValues` (*type:* `map()`, *default:* `nil`) - The runtime parameters of the PipelineJob. The parameters will be passed into PipelineJob.pipeline_spec to replace the placeholders at runtime. This field is used by pipelines built using `PipelineJob.pipeline_spec.schema_version` 2.1.0, such as pipelines built using Kubeflow Pipelines SDK 1.9 or higher and the v2 DSL.
  *   `parameters` (*type:* `%{optional(String.t) => GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1Value.t}`, *default:* `nil`) - Deprecated. Use RuntimeConfig.parameter_values instead. The runtime parameters of the PipelineJob. The parameters will be passed into PipelineJob.pipeline_spec to replace the placeholders at runtime. This field is used by pipelines built using `PipelineJob.pipeline_spec.schema_version` 2.0.0 or lower, such as pipelines built using Kubeflow Pipelines SDK 1.8 or lower.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :failurePolicy => String.t() | nil,
          :gcsOutputDirectory => String.t() | nil,
          :inputArtifacts =>
            %{
              optional(String.t()) =>
                GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1PipelineJobRuntimeConfigInputArtifact.t()
            }
            | nil,
          :parameterValues => map() | nil,
          :parameters =>
            %{
              optional(String.t()) =>
                GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1Value.t()
            }
            | nil
        }

  field(:failurePolicy)
  field(:gcsOutputDirectory)

  field(:inputArtifacts,
    as:
      GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1PipelineJobRuntimeConfigInputArtifact,
    type: :map
  )

  field(:parameterValues, type: :map)
  field(:parameters, as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1Value, type: :map)
end

defimpl Poison.Decoder,
  for: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1PipelineJobRuntimeConfig do
  def decode(value, options) do
    GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1PipelineJobRuntimeConfig.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1PipelineJobRuntimeConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
